{% extends "base.html" %}

{% block content %}		
<h2>
	Loans
</h2>

<table class="records">
	<tr class="heading">
		<td>Person</td>
		<td>Book</td>
		<td>Date</td>
	<tr>
	{% for loan in loans %}
	<tr>
		<td>{{ loan.loaner }}</td>
		<td>{{ loan.book.book.name }}</td>
		<td>{{ loan.date }}</td>
	</tr>
	{% endfor %}
</table>

<form action="/loans" method="post">
	<fieldset>
		<legend>Books</legend>
		<div><label>Person</label><input type="text" name="loaner" /></div>
		<div><label>Book</label>
			<select name="book">
			{% for book in books %}
				<option value="{{ book.book.isbn }}">{{ book.book.name }}</option>
			{% endfor %}
			</select>
		</div>
		<div>
		<input class="submit" type="submit" value="Loan book"></div>
	</fieldset>
</form>

{% endblock %}
